<template>
  <header class="home-header wrap">
    <van-icon name="bars" class="icon-caidan" />
    <div class="header-search">
      <span class="app-name">G</span>
      <van-icon name="search" class="icon-suo" />
      <span class="search-title">家电返场同价11.11</span>
    </div>
    <router-link to="/login" tag="span" class="spanto" v-if="!iocClick"
      >登录</router-link
    >
    <router-link to="/user" tag="span" class="spanto" v-if="iocClick"
      ><i class="iconfont icon-yonghufill"></i
    ></router-link>
  </header>
</template>

<script>
export default {
  data() {
    return {
      // 记录顶部图标切换
      iocClick: false,
    };
  },
  created() {
    if (this.$store.state.isLogin == "true") {
      this.iocClick = true;
    } else {
      this.iocClick = false;
    }
  },
};
</script>

<style lang="scss" scoped>
@import "@/common/style/mixin";
.home-header {
  position: fixed;
  left: 0;
  top: 0;
  @include fj;
  width: 100%;
  height: 80px;
  line-height: 80px;
  padding: 0 20px;
  @include boxSizing;
  font-size: 20px;
  color: #fff;
  z-index: 10000;
  .icon-caidan {
    font-size: 50px;
    margin-top: 20px;
  }
  .header-search {
    display: flex;
    width: 74%;
    height: 40px;
    line-height: 40px;
    margin: 14px 0;
    padding: 7px 0;
    color: #232326;
    background: #fff;
    @include borderRadius(40px);
    .app-name {
      padding: 0 13px;
      color: $red;
      font-size: 35px;
      font-weight: bold;
      border-right: 1px solid #666;
    }
    .icon-suo {
      font-size: 30px;
      padding: 5px;
    }
    .search-title {
      font-size: 18px;
      line-height: 40px;
      color: #666;
    }
  }
  .spanto {
    font-size: 25px;
  }
}
.icon-yonghufill {
  margin-top: 10px;
  font-size: 50px;
}
</style>